package server.valves;

import server.*;
import javax.servlet.ServletException;
import java.io.IOException;

/*
基础阀的超类,要实现基础阀的类可以继承该类,重新invoke方法即可
*/
/*
2023/2/26 该类内容全部写完,后续直接使用,无需修改
by cyl
 */
public abstract class ValveBase implements Contained, Valve {
    //阀所在的容器
    protected Container container;
    protected int debug = 0;
    protected static String info = "server.valves.ValveBase/1.0";

    //方法----------------------------------------------------------------
    public int getDebug() {
        return debug;
    }

    public void setDebug(int debug) {
        this.debug = debug;
    }
    //实现Valve接口----------------------------------------------------------------
    @Override
    public String getInfo() {
        return info;
    }

    @Override
    public abstract void invoke(Request request, Response response, ValveContext context) throws IOException, ServletException;
    //实现Contained接口----------------------------------------------------------------
    @Override
    public Container getContainer() {
        return container;
    }

    @Override
    public void setContainer(Container container) {
        this.container = container;
    }
}
